package com.xm.xmapp;

import java.util.ArrayList;

import android.os.Bundle;
import android.support.v4.app.Fragment;

import com.xm.xmapp.adapter.FragmentStatePagerAdapter;
import com.xm.xmapp.base.BaseActivity;
import com.xm.xmapp.customview.CustomViewPage;
import com.xm.xmapp.fragment.ForGetPasswordFragment1;
import com.xm.xmapp.fragment.ForGetPasswordFragment2;
import com.xm.xmapp.myinterface.ForGetPasswordInterFace;

public class ForGetPasswordActivity extends BaseActivity{

	private CustomViewPage vp;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_forgetpassword);
	}

	@Override
	public void initView() {
		vp = (CustomViewPage) findViewById(R.id.vp);
	}

	@Override
	public void initData() {
		setMyTitle("找回密码");
		ArrayList<Fragment> fragmentList = new ArrayList<Fragment>();
		final ForGetPasswordFragment2 forGetPasswordFrament2 = new ForGetPasswordFragment2();
		ForGetPasswordFragment1 forGetPasswordFrament1 = new ForGetPasswordFragment1(new ForGetPasswordInterFace() {

			@Override
			public void getData(Object phone, Object yanzhengma) {
				vp.setCurrentItem(1);
				forGetPasswordFrament2.setPhone(phone.toString());
				forGetPasswordFrament2.setYanzhengma(yanzhengma.toString());
			}
		});

		fragmentList.add(forGetPasswordFrament1);
		fragmentList.add(forGetPasswordFrament2);
		vp.setAdapter(new FragmentStatePagerAdapter(getSupportFragmentManager(), fragmentList));
		vp.setCurrentItem(0);// 设置当前显示标签页为第一页
		vp.setOffscreenPageLimit(1);
	}

	@Override
	public void initEvent() {

	}


}
